﻿<%@ Page Title="Formula" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
    CodeBehind="FormulaPage.aspx.cs" Inherits="TestJQGrid.FormulaPage" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <style type="text/css">
        .style2
        {
            width: 142px;
        }
        .style3
        {
            width: 169px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <asp:Label ID="lblMenuName" runat="server" Text="Formula" Font-Bold="true" Font-Size="14"></asp:Label>
    <table style="width: 100%;">
        <tr>
            <td align="left" valign="top" style="width: 15%; border: 1px solid;">
                <div style="overflow-x: hidden; overflow: scroll; width: 100%; height: 350px" id="dlFormulaListContainer">
                    <asp:DataList ID="dlFormula" runat="server" RepeatColumns="1" RepeatDirection="Vertical"
                        CellPadding="2" DataKeyField="ID">
                        <ItemTemplate>
                            <asp:LinkButton ID="lbt_formula" Text='<%# DataBinder.Eval(Container.DataItem,"FormulaName") %>'
                                CommandArgument='<%# Eval("ID") %>' runat="server" OnClick="lbt_formula_Click">LinkButton</asp:LinkButton>
                        </ItemTemplate>
                    </asp:DataList>
                </div>
            </td>
            <td align="left" valign="top" style="width: 85%; border: 1px solid;">
                <asp:HiddenField ID="currentControl" runat="server" Value="MainContent_txtThenPart" />
                <asp:HiddenField ID="tableNames" runat="server" />
                <div style="width: 100%; height: auto;">
                    <table width="100%" style="float: left;">
                        <tr>
                            <td class="style3">
                                Name :
                            </td>
                            <td>
                                <asp:TextBox ID="txtFurmulaName" Width="250px" runat="server"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td class="style3">
                                Return Type :
                            </td>
                            <td>
                                <asp:DropDownList ID="ddReturnType" runat="server">
                                    <asp:ListItem Text="Number" Selected="True" Value="number"></asp:ListItem>
                                    <asp:ListItem Text="Date" Value="date"></asp:ListItem>
                                    <asp:ListItem Text="String" Value="string"></asp:ListItem>
                                    <asp:ListItem Text="Bool" Value="bool"></asp:ListItem>
                                </asp:DropDownList>
                                <asp:Label ID="Label1" runat="server" Width="50px"></asp:Label>
                                <asp:Label ID="LabelDestination" runat="server" Text="Destination" Width="70px"></asp:Label>
                                <asp:DropDownList ID="DDLDestination" runat="server" AutoPostBack="True" OnDataBound="DDLDestination_DataBound"
                                    OnSelectedIndexChanged="DDLDestination_SelectedIndexChanged">
                                    <asp:ListItem>Report Creation</asp:ListItem>
                                    <asp:ListItem>Slab Structure</asp:ListItem>
                                    <asp:ListItem>SubRule</asp:ListItem>
                                    <asp:ListItem>Rejection Rule</asp:ListItem>
                                </asp:DropDownList>
                            </td>
                        </tr>
                        <tr>
                            <td class="style3">
                                Definition
                            </td>
                            <td>
                                <asp:TextBox Rows="5" runat="server" Width="400px" ID="txtThenPart" TextMode="MultiLine"
                                    onClick='return setCurrentControl("MainContent_txtThenPart","MainContent_currentControl")'></asp:TextBox>
                                <asp:Label ID="lblThenExp" runat="server"></asp:Label>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Label ID="LabelGroupBy" runat="server" Text="Group By" Width="100"></asp:Label>
                            </td>
                            <td>
                                <asp:TextBox ID="TBGroupBy" runat="server" Width="400px" onClick='return setCurrentControl("MainContent_TBGroupBy", "MainContent_currentControl")'></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td class="style2" colspan="2">
                                <table>
                                    <tr>
                                        <td>
                                            <b style="float: left;">Function List:</b><br />
                                            <asp:ListBox SelectionMode="Single" ID="listFormula" Rows="9" runat="server" onClick='return selectoperator(this.value,"MainContent_currentControl");' />
                                        </td>
                                        <td>
                                            <b style="float: left;">Formula List:</b><br />
                                            <asp:ListBox SelectionMode="Single" ID="listFunction" Rows="9" runat="server" onClick='return selectoperator(this.value,"MainContent_currentControl");' />
                                        </td>
                                        <td>
                                            <b style="float: left;">Field List :</b><br />
                                            <asp:ListBox SelectionMode="Single" ID="listFields" Rows="9" runat="server" onClick='return selectoperator(this.value,"MainContent_currentControl");' />
                                        </td>
                                        <td>
                                            <b style="float: left;">Operators :</b><br />
                                            <table class="buttonList" cellpadding="0" cellspacing="1" style="width: 100px;">
                                                <tr>
                                                    <td>
                                                        <input class="smallbutton" type="button" value="+" onclick='return selectoperator(this.value,"MainContent_currentControl");'
                                                            style="width: 45px; height: 35px;" />
                                                    </td>
                                                    <td>
                                                        <input class="smallbutton" type="button" value="-" onclick='return selectoperator(this.value,"MainContent_currentControl");'
                                                            style="width: 45px; height: 35px;" />
                                                    </td>
                                                    <td>
                                                        <input class="smallbutton" type="button" value="*" onclick='return selectoperator(this.value,"MainContent_currentControl");'
                                                            style="width: 45px; height: 35px;" />
                                                    </td>
                                                    <td>
                                                        <input class="smallbutton" type="button" value="/" onclick='return selectoperator(this.value,"MainContent_currentControl");'
                                                            style="width: 45px; height: 35px;" />
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <input class="smallbutton" type="button" value="(" onclick='return selectoperator(this.value,"MainContent_currentControl");'
                                                            style="width: 45px; height: 35px;" />
                                                    </td>
                                                    <td>
                                                        <input class="smallbutton" type="button" value=")" onclick='return selectoperator(this.value,"MainContent_currentControl");'
                                                            style="width: 45px; height: 35px;" />
                                                    </td>
                                                    <td>
                                                        <input class="smallbutton" type="button" value="=" onclick='return selectoperator(this.value,"MainContent_currentControl");'
                                                            style="width: 45px; height: 35px;" />
                                                    </td>
                                                    <td>
                                                        <input class="smallbutton" type="button" value="!=" onclick='return selectoperator(this.value,"MainContent_currentControl");'
                                                            style="width: 45px; height: 35px;" />
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <input class="smallbutton" type="button" value="<" onclick='return selectoperator(this.value,"MainContent_currentControl");'
                                                            style="width: 45px; height: 35px;" />
                                                    </td>
                                                    <td>
                                                        <input class="smallbutton" type="button" value=">" onclick='return selectoperator(this.value,"MainContent_currentControl");'
                                                            style="width: 45px; height: 35px;" />
                                                    </td>
                                                    <td>
                                                        <input class="smallbutton" type="button" value="&lt;=" onclick='return selectoperator(this.value,"MainContent_currentControl");'
                                                            style="width: 45px; height: 35px;" />
                                                    </td>
                                                    <td>
                                                        <input class="smallbutton" type="button" value="=>" onclick='return selectoperator(this.value,"MainContent_currentControl");'
                                                            style="width: 45px; height: 35px;" />
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <input class="smallbutton" type="button" value="," onclick='return selectoperator(this.value,"MainContent_currentControl");'
                                                            style="width: 45px; height: 35px;" />
                                                    </td>
                                                    <td>
                                                        <input class="smallbutton" type="button" value="AND" onclick='return selectoperator("&&","MainContent_currentControl");'
                                                            style="width: 45px; height: 35px;" />
                                                    </td>
                                                    <td>
                                                        <input class="smallbutton" type="button" value="OR" onclick='return selectoperator("||","MainContent_currentControl");'
                                                            style="width: 45px; height: 35px;" />
                                                    </td>
                                                    <td>
                                                        <input class="smallbutton" type="button" value="NOT" onclick='return selectoperator("!","MainContent_currentControl");'
                                                            style="width: 45px; height: 35px;" />
                                                    </td>
                                                </tr>
                                            </table>
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                    </table>
                </div>
            </td>
        </tr>
        <tr>
            <td>
            </td>
            <td align="center" valign="middle">
                <asp:Button ID="btnValidate" runat="server" Text="Validate" OnClick="btnValidate_Click"
                    OnClientClick="return validateForm();" />
                &nbsp;
                <asp:Button ID="btnReset" runat="server" Text="Reset" OnClick="btnReset_Click" />
                &nbsp;
                <asp:Button runat="server" ID="btnSave" Text="Save Formula" OnClick="btnSave_Click" />
            </td>
        </tr>
    </table>
</asp:Content>
